<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>My first three.js app</title>
		<style>
			body { margin: 0; }
      canvas { width: 100%; height: 100%; }
		</style>
	</head>
	<body>
		<script src="../js/three.js"></script>
		<script>
			// 渲染器
      const renderer = new THREE.WebGLRenderer()
			renderer.setSize(window.innerWidth, window.innerHeight)
			document.body.appendChild(renderer.domElement)

			// 相机
			const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 500)
			camera.position.set(0, 0, 100)
			camera.lookAt(0, 0, 0)

			// 场景
			const scene = new THREE.Scene()

			// 定义材质，线条
			const material = new THREE.LineBasicMaterial({ color: 'skyblue' })

			// 带一些顶点的 Geometry
			const geometry = new THREE.BufferGeometry()
			const pointsArr = []
			pointsArr.push(new THREE.Vector3(-10, 0, 0))
			pointsArr.push(new THREE.Vector3(0, 10, 0))
			pointsArr.push(new THREE.Vector3(10, 0, 0))
			geometry.setFromPoints(pointsArr)

			// 将点和材质组合在一起，形成一条线
			const line = new THREE.Line(geometry, material)

			// 把线添加到场景中，并调用 render 渲染函数
			scene.add(line)
			renderer.render(scene, camera)
		</script>
	</body>
</html>